import { InjectionKey } from 'vue'
import { createStore, Store } from 'vuex'

export interface State {
  token: string|null
}

export const key: InjectionKey<Store<State>> = Symbol()

export const store = createStore<State>({
  state: {
    token: localStorage.getItem('token') ? localStorage.getItem('token'):'',

  },
  mutations: {
    set_token(state, token){
      state.token = token;
      localStorage.setItem('token', token)
    },

  },
  actions:{},
  getters:{}
})